package com.doit.demo01;

import java.util.ArrayList;

public class Demo {
    public static void main(String[] args) {
        Object obj = new Object();
        String string = obj.toString();
        System.out.println(string);//打印的是对象名+@+地址值(哈希值)

        Person p = new Person("赵露思",22);
        System.out.println(p);//默认调用toString
        System.out.println(p.toString());

        String s = "asdad";
        System.out.println(s);//说明String内也重写了toString

        ArrayList<String>list = new ArrayList<>();
        list.add("2s");
        list.add("234sd");
        System.out.println(list);
        System.out.println(list.toString());

        Person p2 = new Person("赵露思",22);
        System.out.println(p.equals(p2));//判断属性
        System.out.println(p==p2);//判断地址

        System.out.println("------------------------");
        System.out.println(p.hashCode());
    }
}
